package com.newland.starpos.partner.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.newland.starpos.partner.bean.UserInfo;
import com.newland.starpos.partner.bean.po.BankCard;
import com.newland.starpos.partner.bean.po.Regional;
import com.newland.starpos.partner.bean.po.User;
import com.newland.starpos.partner.bean.po.UserIdentity;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Set;

/**
 * @author liuNW
 * @since 2018-09-27
 */
public interface UserMapper extends BaseMapper<User> {

    int checkPhoneExist(String telephone);

    Regional findRegionalByCode(String regionalCode);

    User findUserByInviteCode(String inviteCode);

    @Cacheable(value = "user", key = "'UAT_'+#p0")
    UserInfo findUserInfo(String accessToken);

    int insertUserRelation(User newUser);

    Set<Long> findParentIds(Long userId);

    int countChild(Long userId);

    User findUserByPhone(String telephone);

    List<String> findToken(Long userId);

    void invalidToken(List<String> tokens);

    UserIdentity findIdentity(Long userId);

    BankCard findBCBind(Long userId);

    void insertIdentity(UserIdentity identity);

    String findBName(String bCardNo);

    void insertBCard(BankCard bankCard);

    void updateBCard(BankCard bankCard);

    void updateBCardName(BankCard bankCard);
}
